package business {

    import com.adobe.cairngorm.business.ServiceLocator;
    
    import mx.collections.*;
    import mx.rpc.*;
    import mx.rpc.remoting.*;
	
    public class CardDelegate
    {
		private var responder:Object;
        private var service:RemoteObject;

        public function CardDelegate(re:Object)
        {
	        this.service = ServiceLocator.getInstance().getRemoteObject("cardService");
            this.responder = re;
        }
        
        public function getCards(page:int):void
        {
            var token:AsyncToken;
            var itemResponder:ItemResponder;
            token = service.getCards(page);
            itemResponder = new ItemResponder(responder["getCardsResult"],responder["fault"] );
            token.addResponder(itemResponder);
        }

        public function getCardsByAuditGood(page:int):void
        {
            var token:AsyncToken;
            var itemResponder:ItemResponder;
            token = service.getCardsByAuditGood(page);
            itemResponder = new ItemResponder(responder["getCardsByAuditGoodResult"],responder["fault"] );
            token.addResponder(itemResponder);
        }

        public function getCardsByAudit(page:int,range:String="unaudit"):void
        {
            var token:AsyncToken;
            var itemResponder:ItemResponder;
            token = service.getCardsByAudit(page,range);
            itemResponder = new ItemResponder(responder["getCardsForAuditResult"],responder["fault"] );
            token.addResponder(itemResponder);
        }

        public function getCardsById(ids:Array):void
        {
            var token:AsyncToken;
            var itemResponder:ItemResponder;
            token = service.getCardsById(ids);
            itemResponder = new ItemResponder(responder["getCardsByIdResult"],responder["fault"] );
            token.addResponder(itemResponder);
        }

        public function getCardsByAuditGoodBySearch(pattern:String, type:String, page:int=0):void
        {
            var token:AsyncToken;
            var itemResponder:ItemResponder;
            token = service.getCardsByAuditGoodBySearch(pattern,type,page);
            itemResponder = new ItemResponder(responder["getCardsBySearchResult"],responder["fault"] );
            token.addResponder(itemResponder);
        } 
        
        public function getCardsBySearch(pattern:String, type:String, page:int=0, showAssetType:int=3):void
        {
            var token:AsyncToken;
            var itemResponder:ItemResponder;
            token = service.getCardsBySearch(pattern,type,page,showAssetType);
            itemResponder = new ItemResponder(responder["getCardsBySearchResult"],responder["fault"] );
            token.addResponder(itemResponder);
        }  
                        
        public function removeCards(page:int,ids:Array):void
        {
            var token:AsyncToken;
            var itemResponder:ItemResponder;
            token = service.removeCards(page,ids);
            itemResponder = new ItemResponder(responder["removeCardsResult"],responder["fault"] );
            token.addResponder(itemResponder);
        }              

        public function updateCard(ids:Array,update:Object):void
        {
            var token:AsyncToken;
            var itemResponder:ItemResponder;
            token = service.updateCard(ids,update);
            itemResponder = new ItemResponder(responder["updateCardResult"],responder["fault"] );
            token.addResponder(itemResponder);
        }
        
        public function sendMsgRecom(bid:String, assetTitle:String, assetUrl:String):void
        {
            var token:AsyncToken;
            var itemResponder:ItemResponder;
            token = service.sendMsgRecom(bid,assetTitle,assetUrl);
            itemResponder = new ItemResponder(responder["sendMsgRecomResult"],responder["fault"] );
            token.addResponder(itemResponder);        	
        }
        
        public function getWords():void
        {
            var token:AsyncToken;
            var itemResponder:ItemResponder;
            token = service.getWords();
            itemResponder = new ItemResponder(responder["getWordsResult"],responder["fault"] );
            token.addResponder(itemResponder);        	
        }         
        
		public function getZoneList():void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.getZoneList();
			itemResponder = new ItemResponder(responder["getZoneListResult"],responder["fault"] );
			token.addResponder(itemResponder);    
		}
		
		public function getCardByZone(num:int, mod:int, limit:int=20):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.getCardByZone(num, mod, limit);
			itemResponder = new ItemResponder(responder["getCardByZoneResult"],responder["fault"] );
			token.addResponder(itemResponder);    
		}
		
		public function updateZone(num:int):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.updateZone(num);
			itemResponder = new ItemResponder(responder["updateZoneResult"],responder["fault"] );
			token.addResponder(itemResponder);    
		}
		
		public function backToQiqu(id:int):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.backToQiqu(id);
			itemResponder = new ItemResponder(responder["backToQiquResult"],responder["fault"] );
			token.addResponder(itemResponder);    
		}
		
		
		
		
    }
}

